/*
 * UserManager.h
 *
 *  Created on: 2013-1-29
 *      Author: Dspark
 */

#ifndef USERMANAGER_H_
#define USERMANAGER_H_
#include <QDialog>
#include <QLabel>
#include <QLineEdit>
#include <QPushButton>
#include <QTableWidget>
#include <qlayout.h>
#include <QtSql>
#include <QSqlRelationalDelegate>
#include <QDebug>
#include "ModifyUser.h"
#include "../utile/DAObject.h"
#include "../bo/User.h"

class UserManager : public QDialog
{
	Q_OBJECT
public:
//	enum{addMode = 0, modifyMode = 1};
	UserManager(QWidget *parent = 0);
	virtual ~UserManager();
private slots:
	void search();
	void slt_buttonEnabled(int row, int column);
	void slt_modifyMode();
	void slt_addMode();
	void slt_lock();
	void slt_modifyOrAdd(const int &mode, const int &id, const QString &name, const QString &loginName,
			const int &type, const bool &locked, const QString &password);
private:
	QLabel label;
	QLineEdit lineEdit;
	QPushButton searchButton;
	QPushButton addUserButton;
	QPushButton lockButton;
	QPushButton modifyButton;
	QTableWidget table;
	ModifyUser modifyDialog;
//	User user;
//	QSqlRelationalTableModel *mode;
//	QSqlTableModel *mode;
//	QTableWidgetItem item;
//	QHBoxLayout topLayout;
//	QVBoxLayout mainLayout;
	QSqlDatabase db;

};

#endif /* USERMANAGER_H_ */
